<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			* {
				margin: 0 auto;
				padding: 0;
			}
			
			.kuang1-1 {
				height: 30px;
				width: 1000px;
				border-top: 1px solid #A0A0A0;
				background-color: #E8E8E8;
				border-right: 1px solid #A0A0A0;
				border-left: 2px solid #F10180;
			}
			
			.daohang li {
				font-size: 16px;
				line-height: 2em;
			}
			
			.lf {
				width: 153px;
				text-align: center;
				float: right;
			}
			
			.lr {
				width: 300px;
				color: #F10180;
				margin-left: 10px;
				float: left;
				font-weight: bold;
			}
			
			#zhong1 {
				width: 1001px;
				border-left: 1px solid #A0A0A0;
				border-right: 1px solid #A0A0A0;
			}
			
			.zhekou {
				height: 50px;
				width: 1000px;
			}
			
			.zhekou1 {
				height: 40px;
				width: 980px;
				background-color: #FCEAD3;
				position: relative;
				left: 2px;
				top: 5px;
			}
			
			.zhekou2 {
				height: 30px;
				width: 50px;
				background-color: #FF9933;
				line-height: 1.6em;
				text-indent: 8px;
				color: white;
				position: relative;
				left: -450px;
				top: 5px;
			}
			
			.wenzi {
				position: relative;
				top: -19px;
				left: 75px;
			}
			
			.wenzi p {
				margin-left: 10px;
				font-size: 13px;
			}
			
			#buytab {
				width: 980px;
			}
			
			#buytab a {
				text-decoration: none;
				color: black;
			}
			
			.zhong3 {
				border: 1px solid #A0A0A0;
				width: 1001px;
				height: 90px;
			}
			
			.kong {
				height: 100px;
			}
			
			.ljgm {
				width: 1000px;
				height: 50px;
				border: 1px solid #A0A0A0;
				background-color: #E8E8E8;
			}
			
			.goumai {
				background-color: #F10180;
				color: white;
			}
			
			.goumai p {
				font-size: 20px;
			}
			
			.td7 {
				color: gray;
				text-indent: 300px;
				width: 500px;
			}
			
			#td8 {
				color: #F10180;
				font-size: 30px;
			}
			
			#td9 {
				background-color: #F10180;
				color: white;
				font-size: 18px;
				text-align: center;
			}
			
			#buytab2 {
				width: 1000px;
				height: 50px;
			}
			input{
				text-align: center;
			}
			.heji{width: 50px;}
			.laosi{height: 100px;width: 150px;border-radius: 15px;border: 1px solid red; text-align: center;line-height: 4em;font-size: 20px;}
			
		</style>
	</head>

	<body>
		<div class="kuang1-1">
			<ul type="none" class="daohang">
				<li class="lr">唯品自营</li>
				<li class="lf">操作</li>
				<li class="lf">小计</li>
				<li class="lf">数量</li>
				<li class="lf">单价</li>
			</ul>
		</div>
		<div id="zhong1">
			<div class="zhekou">
				<div class="zhekou1">
					<div class="zhekou2">
						<p>折扣</p>
					</div>
					<div class="wenzi">
						<p>已满足买1件8折优惠 [已优惠¥388.8]</p>

					</div>
				</div>
			</div>
			<div class="zhong2">
				<table id="buytab" border="0" cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<!--<td class="td1">
								<div class="tupian">
									<img src="img/460827e5-7c39-40a4-bb8d-677b33102742_420x531_90.jpg" />
								</div>
							</td>
							<td class="td2">
								<a href="#">新年献礼－鄂尔多斯erdos羊绒男女混合专场 鄂尔多斯半高领翻花羊绒衫女士毛衣</a>
								<p>尺码：xl</p>
							</td>
							<td class="td3">1955</td>
							<td class="td4"><input type="button" name="" id="" value="-" /><input type="text" name="" id="text1" value="1" size="1" /><input type="button" name="" id="" value="+" /></td>
							<td class="td5">1955</td>
							<td class="td6">
								<span onclick="deltr()">删除</span>
							</td>-->

						</tr>
					</tbody>

				</table>
			</div>
		</div>
		<div class="zhong3">
			<div>
				<div>
					<div class="zhekou2">
						<p>运费</p>
					</div>
					<div class="wenzi">
						<p>本组商品已免运费。</p>

					</div>
				</div>
				<div>
					<div>
						<div class="zhekou2">
							<p>买赠</p>
						</div>
						<div class="wenzi">
							<p>购物即赠水星VIP大牌日380元组合红包，送完即止</p>

						</div>
					</div>
				</div>

				<div class="kong">

				</div>
				<div class="ljgm">

					<table id="buytab2" border="0" cellspacing="0" cellpadding="0">

						<tr>
							<td class="td7">请在倒计时结束前付款</td>
							<td class="heji">合计：</td>
							<td id="td8">0</td>
							<td id="td9">立即购买 250秒</td>
						</tr>
					</table>
					<p class="laosi" onclick=addfun()>添加</p>
				</div>
				<script type="text/javascript">
					/**
					 * 添加TR
					 */
					function addfun() {
						var tbody = document.getElementById("buytab").children[0];
						var tr = document.createElement("tr");
						var td1 = document.createElement("td");
						td1.innerHTML = "<img src='img/460827e5-7c39-40a4-bb8d-677b33102742_420x531_90.jpg'height='120px'width='100px' />"
						td1.width = "110px"
						var td2 = document.createElement("td");
						td2.innerHTML = "<a href='#'>新年献礼－鄂尔多斯erdos羊绒男女混合专场 鄂尔多斯半高领翻花羊绒衫女士毛衣</a>+<p>尺码：xl</p> "
						td2.width = "330px"
						td2.setAttribute("class", "td2")
						var td3 = document.createElement("td");
						td3.innerHTML = parseInt(Math.random() * 1000)
						td3.setAttribute("class", "td3")
						td3.width = "140px"
                        
						var td4 = document.createElement("td");
						td4.innerHTML = "<input type='button'value='-' onclick='jian(this)'/><input type='text'value='1'size='1' align='center' onchange='setnum(this)'/><input type='button' value='+'onclick='jiafa(this)'/>"

						td4.width = "170px";
						td4.setAttribute("class", "td4")

						var td5 = document.createElement("td");
						td5.innerHTML = td3.innerHTML
						td5.setAttribute("class", "td5")
						td5.width = "150px"
						var td6 = document.createElement("td");
						td6.innerHTML = "<span onclick='deltr(this)'>" + "删除" + "</span>"
						td6.setAttribute("class", "td6")

						tr.appendChild(td1)
						tr.appendChild(td2)
						tr.appendChild(td3)
						tr.appendChild(td4)
						tr.appendChild(td5)
						tr.appendChild(td6)
						tbody.appendChild(tr)
						sum();
					}

					function deltr(t) {
						var tbody = document.getElementById("buytab").children[0];
						tbody.removeChild(t.parentNode.parentNode)
					}
					var src = document.referrer
					if(src == "") {
						var i = 250;
						setInterval(function() {
							document.getElementById("td9").innerHTML = "立即购买 " + i + "秒"
							i--;
						}, 1000)

					}

					function sum() {
						var tab = document.getElementById("buytab");
						var sum = 0;
						for(var i = 1; i < tab.rows.length; i++) {
							sum += tab.rows[i].cells[4].innerHTML * 1;
						}
						document.getElementById("td8").innerHTML = sum;
					}

					function jian(t) {

						if(t.parentNode.children[1].value > 1) {
							t.parentNode.children[1].value--;
							var danjia = t.parentNode.parentNode.children[2].innerHTML;
							var shuliang = t.parentNode.children[1].value;
							t.parentNode.parentNode.children[4].innerHTML = danjia * shuliang;
						}
						sum()
					}

					function jiafa(t) {
						t.parentNode.children[1].value++;
						var danjia = t.parentNode.parentNode.children[2].innerHTML;
						var shuliang = t.parentNode.children[1].value;
						t.parentNode.parentNode.children[4].innerHTML = danjia * shuliang;

						sum()
					}
				</script>
	</body>

</html>